using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Plugin.Tool;

namespace Platform.Buff.Buffs
{
    public class IgnitedBuff : BuffBase
    {
        private float fireTimer = 0;

        public override void OnStart()
        {
            base.OnStart()  ;
            ZTimer.SetInterval(0.2f, Fx.FireColorFx);
        }
        public override void OnEnd()
        {
            base.OnEnd();
            ZTimer.ClearTimer(Fx.FireColorFx);
            Fx.CancelColorChange();
        }

        public override void OnEffect()
        {
            fireTimer += Time.fixedDeltaTime;
            if (fireTimer >= interalTime)
            {
                currentTarget.CurrentHealth -= effectValue;
                currentTarget.OnHealthChange?.Invoke();
                fireTimer = 0;
            }
            base.OnEffect();
        }
    }
}